'use strict'
// Template version: 1.2.6
// see http://vuejs-templates.github.io/webpack for documentation.
const ios = require('./os');
const path = require('path')
module.exports = {
  dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '/portal': {
        target: 'http://172.18.21.40:7091/', // 开发外网
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/ems': '/'  // 为了上传组件 , 改写路径
        // }
      },
      '/tediship': {
        target: 'http://192.168.3.26:9091/', // EDI开发
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/ems': '/'  // 为了上传组件 , 改写路径
        // }
      },
  /*    '/container': {
        // target: 'http://172.18.20.76:6016/', // 开发外网
        target: 'http://localhost:7072/', // 开发外网
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/ems': '/'  // 为了上传组件 , 改写路径
        // }
      }, */
      '/file': {
        // target: 'http://172.18.20.76:6016/', // 开发外网
        target: 'https://zhoudaowang.oss-cn-hangzhou.aliyuncs.com/container/', // 开发外网
        changeOrigin: true,
        secure: false,
       pathRewrite: {
          '^/file': '/'  // 为了上传组件 , 改写路径
        }
      },
      '/tos': {
        // target: 'http://172.18.20.76:6016/', // 开发外网
        target: 'http://localhost:7072/', // 开发外网
        // target: 'http://192.168.31.59:7072/', // 扬奕开发外网
        // target: 'http://192.168.3.28:7072/', // 扬奕开发外网
        // target: 'http://192.168.0.7:7072/', // 扬奕开发外网
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/ems': '/'  // 为了上传组件 , 改写路径
        // }
      },
      '/qcmonitor': {
        // target: 'http://172.18.20.83:7078/', // 开发外网
        target: 'http://localhost:7078/', // 开发本地
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/ems': '/'  // 为了上传组件 , 改写路径
        // }
      },
      '/data': {
        target: 'http://218.56.157.76:9010/', // 这个是物资系统的
        changeOrigin: true,
        secure: false
      },
      '/files': {
        target: 'http://172.18.20.76:8016/', // 上传图片预览的图片转发到可以访问
        changeOrigin: true,
        secure: false
      },
      '/photo': {
        target: 'http://172.18.20.34:8093/files/', // 开发外网
        changeOrigin: true,
        secure: false,
       pathRewrite: {
          '^/photo': '/'  // 为了上传组件 , 改写路径
        }
      },
    },

    // Various Dev Server settings

    // can be overwritten by process.env.HOST
    // if you want dev by ip, please set host: '0.0.0.0'
    host: {
      ip: ios.ip
    },
    port: 9014, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: true,
    errorOverlay: true,
    notifyOnErrors: false,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: false,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: '#source-map', //‘inline-source-map’

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false,
  },

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    imgDir: path.resolve(__dirname, '../dist/src/assets/images'),
    assetsSubDirectory: 'static',

    /**
     * You can set by youself according to actual condition
     * You will need to set this if you plan to deploy your site under a sub path,
     * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
     * then assetsPublicPath should be set to "/bar/".
     * In most cases please use '/' !!!
     */
    assetsPublicPath: '/', // If you are deployed on the root path, please use vue-element-admin'/'

    /**
     * Source Maps
     */
    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}
